Package org.openquark.cal_Cal_Utilities_DirectedGraph

Source Code of org.openquark.cal_Cal_Utilities_DirectedGraph.Get_Vertex

package org.openquark.cal_Cal_Utilities_DirectedGraph;

import org.openquark.cal.internal.runtime.lecc.RTCons;
import org.openquark.cal.internal.runtime.lecc.RTExecutionContext;
import org.openquark.cal.internal.runtime.lecc.RTResultFunction;
import org.openquark.cal.internal.runtime.lecc.RTSupercombinator;
import org.openquark.cal.internal.runtime.lecc.RTValue;
import org.openquark.cal.runtime.CALExecutorException;
import org.openquark.cal.runtime.ErrorInfo;
import org.openquark.cal_Cal_Collections_IntMap.Find;

public final class Get_Vertex extends RTSupercombinator {
  /**
   * Singleton instance of this class.
   */
  public static final Get_Vertex $instance = new Get_Vertex();

  /*
   * ErrorInfo instances.
   */

  private static final ErrorInfo Cal_Utilities_DirectedGraph_getVertex_386_32 =
    new ErrorInfo("Cal.Utilities.DirectedGraph", "getVertex", 386, 32);

  private Get_Vertex() {
  }

  public final int getArity() {
    return 2;
  }

  public final java.lang.String getModuleName() {
    return "Cal.Utilities.DirectedGraph";
  }

  public final java.lang.String getUnqualifiedName() {
    return "getVertex";
  }

  public final java.lang.String getQualifiedName() {
    return "Cal.Utilities.DirectedGraph.getVertex";
  }

  /**
   * f
   * This method implements the function logic of the CAL function Cal.Utilities.DirectedGraph.getVertex
   */
  public final RTValue f(final RTResultFunction $rootNode, final RTExecutionContext $ec) throws CALExecutorException {
    // Arguments
    RTValue vertexNum = $rootNode.getArgValue();
    RTValue graph = $rootNode.prevArg().getArgValue();

    // Release the fields in the root node to open them to garbage collection
    $rootNode.clearMembers();
    return
      f2S(
        RTValue.lastRef(graph, graph = null),
        RTValue.lastRef(vertexNum, vertexNum = null),
        $ec);
  }

  /**
   * f2L
   * This method implements the function logic of the CAL function Cal.Utilities.DirectedGraph.getVertex
   */
  public final RTValue f2L(RTValue graph, RTValue vertexNum, RTExecutionContext $ec) throws CALExecutorException {
    return
      f2S(
        RTValue.lastRef(graph, graph = null),
        RTValue.lastRef(vertexNum, vertexNum = null),
        $ec);
  }

  /**
   * f2S
   * This method implements the function logic of the CAL function Cal.Utilities.DirectedGraph.getVertex
   */
  public final RTValue f2S(RTValue graph, RTValue vertexNum, RTExecutionContext $ec) throws CALExecutorException {
    // Top level supercombinator logic
    return
      Find.$instance.f2S(
        vertexNum.evaluate($ec).getOrdinalValue(),
        (((RTCons)(java.lang.Object)
          graph.evaluate($ec))).getFieldByIndex(
          0,
          1,
          Get_Vertex.Cal_Utilities_DirectedGraph_getVertex_386_32).evaluate(
          $ec),
        $ec);
  }

}
TOP

Related Classes of org.openquark.cal_Cal_Utilities_DirectedGraph.Get_Vertex

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.